<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="../css/main.css"/>
		<link rel="stylesheet" href="../css/follow.css" />
		<style type="text/css">
			.mui-bar-nav{
				border: none;
				outline: none;
				-webkit-box-shadow:none;
				box-shadow:none;
				border-bottom: 1px solid rgba(0, 0, 0, .1);
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav header" style="background-color: white;">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left" ></a>
			<h1 class="mui-title">关注</h1>
		</header>
		<div class="mui-content">
			
				
							<ul id="OA_task_1" class="mui-table-view" style="margin-top: 0px;">
							<div id="follow">
								<li class="mui-table-view-cell" v-for="f in add" :id="f.id">
									<div class="mui-slider-right mui-disabled">
										<a class="mui-btn mui-btn-red">删除</a>
									</div>
									<div class="mui-slider-handle">
										<a href="javascript:;" >
										<img class="mui-media-object mui-pull-left avater_img" :src="f.avatar" >
										<div class="mui-media-body">
											<h5 style="color: black;" v-text="f.username"></h5>
											<p class='mui-ellipsis' v-text="f.remarks"></p>
										</div>
									</a>
									</div>
								</li>
							</div>
						</ul>
				
			</div>
		
		<script src="../js/mui.min.js"></script>
		<script src="../vue/vue.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/ip.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			mui.init();
			
			mui.plusReady(function(){
				
					mui.ajax('http://'+ip+'/xiaojv/Api/index.php?p=front&m=follow&a=followdata',{
						data:{},
						dataType:'json',//服务器返回json格式数据
						type:'post',//HTTP请求类型
						timeout:10000,//超时时间设置为10秒；           
						success:function(data){
							appdata = data;
							var one = new Vue({
								el : '#follow',
								data : {
									add : appdata
								}
							});
							
						
						},
						error:function(xhr,type,errorThrown){
							//异常处理；
							console.log(type);
						}
					});
				});
			
			
			(function($) {
				//$.swipeoutOpen(el,direction)//打开指定列的滑动菜单，el:指定列的dom对象，direction：取值left|right，指定打开的是左侧或右侧滑动菜单
				//$.swipeoutClose(el);//关闭指定列的滑动菜单，el:指定列的dom对象
				//				setTimeout(function() {
				//					$.swipeoutOpen(document.getElementById("OA_task_1").querySelector('li:last-child'), 'left');
				//					setTimeout(function() {
				//						$.swipeoutClose(document.getElementById("OA_task_1").querySelector('li:last-child'));
				//					}, 1000);
				//				}, 1000);
				//第一个demo，拖拽后显示操作图标，点击操作图标删除元素；
				
				
				
				
				$('#OA_task_1').on('tap', '.mui-btn', function(event) {
					
					var elem = this;
					var li = elem.parentNode.parentNode;
					var delfollowid = li.id;
					mui.confirm('确认删除该条记录？', 'Hello MUI', btnArray, function(e) {
						if (e.index == 0) {
							li.parentNode.removeChild(li);
							
							mui.ajax('http://'+ip+'/xiaojv/Api/index.php?p=front&m=follow&a=delfollow',{
								data:{'delfollowid':delfollowid},
								dataType:'json',//服务器返回json格式数据
								type:'get',//HTTP请求类型
								timeout:10000,//超时时间设置为10秒；           
								success:function(data){
									if(data.msg==200){
										mui.toast(data.i);
									}else{
										mui.toast(data.i);
									}
								},
								error:function(xhr,type,errorThrown){
									//异常处理；
									console.log(type);
								}
							});
							
							
						} else {
							setTimeout(function() {
								$.swipeoutClose(li);
							}, 0);
						}
					});
				});
				var btnArray = ['确认', '取消'];
				
			})(mui);
			
			
			
		
		</script>
	</body>

</html>